<?php
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2020.
// +----------------------------------------------------------------------
// | Describe: 报名操作模型类
// +----------------------------------------------------------------------
// | Author: woniu
// +----------------------------------------------------------------------
 class records
 {
	/** 
	* 获取单条报名信息
	* 
	* @access static
	* @name getSingleRecords 
	* @param mixed  参数一的说明 
	* @return array 
	*/  
	static function getSingleRecords($id){
		global $_W;
		$records = pdo_get('aide_activity_records', array('uniacid'=>$_W['uniacid'],'id' => $id));
		return $records;
	}
	
	static function getNumSpecData($id){
		global $_W;
		$specdata = pdo_fetchall("select * from " . tablename('aide_spec_data') . " where recordid=".$id." order by id asc");
		return $specdata;
	}

     //导出检录表格
     static function exportExcelJianlu($list, $append=''){
         require_once IA_ROOT."/tp/extend/excel/Excel.php";

         $excelObj = new Excel();
         $tags = array(
             '人员ID',
             '姓名',
             '性别',
             '身份证号',
             '民族',
             '地址',
             '电话',
             '岗位',
             '子公司',
             '部门',
             '卡号',
         );
         $fiters = array(
             'imageno',
             'realname',
             'gender',
             'idcard',
             'nation',
             'address',
             'mobile',
             'position',
             'company',
             'department',
             'cardnumber',
         );
         if(!empty($apend) && is_array($apend)){
             foreach($apend as $k=>$v){
                 $apend_tags[] = $v['name'];
                 $apend_fiters[] = 'attr_' . $v['attr_id'];
             }
             $tags = array_merge($tags, $apend_tags);
             $fiters = array_merge($fiters, $apend_fiters);
         }
         $data = array();
         foreach($list as $k => $v){
             for($i=0; $i<=count($fiters); $i++){
                 if($fiters[$i]) $data[$k][$fiters[$i]] = strval($v[$fiters[$i]])."\t";
             }
         }
         $excelObj->down($tags, $data, 'jianlu');
     }

}
